<a href='https://github.com/angular/angular.js/edit/v1.5.x/docs/content/error/$injector/cdep.ngdoc?message=docs(error%2Fcdep)%3A%20describe%20your%20change...' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit">&nbsp;</i>Improve this Doc</a>


<h1>Error: $injector:cdep
  <div><span class='hint'>Circular Dependency</span></div>
</h1>

<div>
    <pre class="minerr-errmsg" error-display="Circular dependency found: {0}">Circular dependency found: {0}</pre>
</div>

<h2>Description</h2>
<div class="description">
  <p>This error occurs when the <a href="api/ng/function/angular.injector">$injector</a> tries to get
a service that depends on itself, either directly or indirectly. To fix this,
construct your dependency chain such that there are no circular dependencies.</p>
<p>For example:</p>
<pre><code>angular.module(&#39;myApp&#39;, [])
.factory(&#39;myService&#39;, function (myService) {
  // ...
})
.controller(&#39;MyCtrl&#39;, function ($scope, myService) {
  // ...
});
</code></pre>
<p>When an instance of <code>MyCtrl</code> is created, the service <code>myService</code> will be created
by the <code>$injector</code>. <code>myService</code> depends on itself, which causes the <code>$injector</code>
to detect a circular dependency and throw the error.</p>
<p>For more information, see the <a href="guide/di">Dependency Injection Guide</a>.</p>

</div>


